<template>
	<el-row style="height: 100%; width: 100%">
		<h1 style="float: left; height: 100%; line-height: 60px">供应链金融应用</h1>
		<el-button
			type="success"
			style="float: right; font-size: 20px; margin: 5px 30px 0 0; color: #fff"
			@click="logout"
			>登出</el-button
		>
	</el-row>
</template>

<script>
export default {
	name: 'Header',
	methods: {
		logout: function () {
			this.$cookies.remove('orgType')
			this.$cookies.remove('address')
			this.$router.push('/login')
		},

		// 调用一个是否自动提示,把axios掩盖掉了
		isLogin() {
			if (!this.$cookies.get('address')) {
				this.$alert('您尚未登录!', '提示', {
					confirmButtonText: '确定',
					callback: () => {
						this.$router.push('/login')
					},
				})
			}
		},
	},
	mounted() {
		this.isLogin()
	},
}
</script>

<style scoped></style>

